package com.nondo.rdp.finance.model.circle;

import java.util.ArrayList;
import java.util.List;

import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.nondo.rdp.auth.model.UserBeanInner;
import com.nondo.rdp.core.common.BeanUtils;
import com.nondo.rdp.finance.domain.circle.CircleComment;

/**
 * 金融圈-说说-评论
 */
public class CircleCommentBean {
	private Long id; // 主键ID
	private String body; // 评论内容
	private Long circleId; // 说说ID
	private UserBeanInner user; // 用户信息
	private UserBeanInner toUser; // 被评论用户信息
	private Long toUserId; // 被评论用户ID

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@NotNull(message = "内容不能为空")
	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	@JsonIgnore
	public Long getCircleId() {
		return circleId;
	}

	@JsonSetter
	public void setCircleId(Long circleId) {
		this.circleId = circleId;
	}

	public UserBeanInner getUser() {
		return user;
	}

	public void setUser(UserBeanInner user) {
		this.user = user;
	}

	public UserBeanInner getToUser() {
		return toUser;
	}

	public void setToUser(UserBeanInner toUser) {
		this.toUser = toUser;
	}

	@JsonIgnore
	public Long getToUserId() {
		return toUserId;
	}

	@JsonSetter
	public void setToUserId(Long toUserId) {
		this.toUserId = toUserId;
	}

	public static List<CircleCommentBean> covert2BeanList(
			List<CircleComment> comments) {
		List<CircleCommentBean> commentBeans = new ArrayList<CircleCommentBean>();
		for (CircleComment comment : comments) {
			CircleCommentBean commentBean = CircleCommentBean.covert2Bean(comment);
			commentBeans.add(commentBean);
		}
		return commentBeans;
	}

	public static CircleCommentBean covert2Bean(CircleComment comment) {
		CircleCommentBean commentBean = new CircleCommentBean();
		BeanUtils.copy(comment, commentBean);
		return commentBean;
	}

}
